/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package taikai;

import java.awt.Component;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JComboBox;
import javax.swing.JList;


public class GradeEditor extends DefaultCellEditor {

    public GradeEditor() {
        super(new JComboBox(Grade.values()));
        ((JComboBox)editorComponent).setRenderer(new DefaultListCellRenderer() {

            @Override
            public Component getListCellRendererComponent(JList jlist, Object o, int i, boolean bln, boolean bln1) {
                setText(((Grade)o).title);
                return this;
            }

        });
    }

    @Override
    public Object getCellEditorValue() {
        System.out.println(super.getCellEditorValue());
        return super.getCellEditorValue();
    }

}
